package sysTest

import (
	"fmt"
	"os"
)

func main() {

}

func lockProcess() {
	lockFile := "/var/run/xxxxxx.pid"
	lock, err := os.Create(lockFile)
	if err != nil {
		fmt.Println("create /var/run/xxxxxx.pid error:", err)
	}

	defer os.Remove(lockFile)
	defer lock.Close()

	//syscall.Exec()
	//err = syscall.flock()(int(lock.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)

	if err != nil {
		fmt.Println("xxxxxx is running,/var/run/xxxxxx.pid exists")
		os.Exit(1)
	}
}
